<template>
  <div class="box" :style="vscreen">
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide" style="background: #ddd">1</div>
        <div class="swiper-slide" style="background: #efefef">2</div>
        <div class="swiper-slide" style="background: #add">3</div>
        <div class="swiper-slide" style="background: #ddd">4</div>
      </div>
      <div class="swiper-pagination"></div>
    </div>
  </div>
</template>
<script>
import "swiper/dist/css/swiper.min.css";
import Swiper from "swiper";
export default {
  data() {
    return {
      mySwiper: null, //swiper实例
      vscreen: {
        height: "",
        width: "",
      },
    };
  },
  created() {
    this.vscreen.height = document.body.clientHeight + "px";
    this.vscreen.width = document.body.clientWidth + "px";
  },
  mounted: function () {
    var swiper = new Swiper(".swiper-container", {
      resistanceRatio: 0, // swiper第一页和最后一页禁滑动空白出现
      direction: "vertical",
    });
  },
};
</script>


<style scoped lang="less">
.box {
  width: 300px;
  // height: 200px;
  border: 1px solid #f00;
}

.swiper-container {
  width: 100%;
  height: 100%;
}

.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.vscreen {
  position: absolute;
  top: 0;
}
</style>
